Post Data
In this tutorial, we will build a very simple ao process that can send POST HTTP request using 0rbit oracle network.
Getting Started with aos
To work with the ao computer, your machine requires a local environment to run the ao process, which aos will provide.
- Install aos Fire up your terminal and run:
bash
npm i -g https://get_ao.g8way.io- Launch aos Next, create your instance of aos:
bash
aos- Store the 0rcale
processIdThis will initialize a variable with theprocessIdof the 0rcale.
lua
_0rbit = "WSXUI2JjYUldJ7CKq9wE1MGwXs-ldzlUlHOQszwQe0s"And voilà! Let's post the data!
Posting Data
- Start your editor
bash
.editor- Create a command to post data.
lua
local json = require("json")
Send({
Target = _0RBIT,
Action = "Post-Real-Data",
Url = "https://arweave.net/graphql",
Body = json.encode({
query = [[
query {
transactions(
owners: ["vh-NTHVvlKZqRxc8LyyTNok65yQ55a_PJ1zWLb9G2JI"]
) {
edges {
node {
id
}
}
}
}
]],
variables = {}
})
})In this command:
jsonis a library that is required to encode the data into json format.TARGETis the process ID of theaoprocess user wants to interact with, which in this case is 0rbit's GETaoprocess.Actionis the specific tag required by 0rbit to perform the Post request.Urlis the Http URL where the request will be sent.Bodyis the data that will be sent to the Http URL.
- Execute the command
This will end your editor and execute the command.
bash
.doneYou will receive a new message in a few seconds, including your requested data.
Awesome! You have successfully posted data to the web using the 0rbit oracle network.
If you have any doubts or questions, feel free to ask in the 0rbit Discord.